/*
lc3158. 求出出现两次数字的 XOR 值
https://leetcode.cn/problems/find-the-xor-of-numbers-which-appear-twice/submissions/572151521/?envType=daily-question&envId=2024-10-12
*/
class Solution {
public:
    int duplicateNumbersXOR(vector<int>& nums) {
        unordered_map<int,int>p;
        int num=0;
        for(int i=0;i<nums.size();++i){
            ++p[nums[i]];
            if(p[nums[i]]==2) {
                num^=nums[i];
            }
        }
        return num;
    }
};